from flask import Flask
from flask_socketio import SocketIO, rooms
from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy
import redis
from celery import Celery

from config import Config

app = Flask(__name__, static_url_path='/static')
app.config.from_object(Config)

socketio = SocketIO()
socketio.init_app(app)

db = SQLAlchemy()
db.init_app(app)

login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'sign_in'
redis_db = redis.StrictRedis(host=app.config['REDIS_SERVER'], port=app.config['REDIS_PORT'], db=app.config['REDIS_DB'])

celery = Celery()
celery.config_from_object(Config)

from cyoa import views, websockets, wizard_views